<template>
  <div class="cbody">
    <el-row :gutter="24" style="padding: 5px 10px;background-color: #f6f6f6">
      <el-col :span="21">
        <el-button type="info" @click="copyBill">复制</el-button>
        <el-button type="success" @click="saveEdit">保存</el-button>
      </el-col>
      <el-col :span="3">
        <el-button-group>
          <el-button type="primary" icon="el-icon-arrow-left" @click="toLast" />
          <el-button type="primary" icon="el-icon-arrow-right" @click="toNext" />
        </el-button-group>
      </el-col>
    </el-row>
    <!-------------------------------表格 ----------------------top ------------------->
    <div class="content">
      <div>
        <div class="toptable">
          <div class="toptd">产品型号:<input v-model="form.chanpingxinghao" class="topinp"> </div>
          <div class="toptd">生产单号:<input v-model="form.shengchandanhao" class="topinp"> </div>
          <div class="toptd">生产线号:<input v-model="form.shengchanxianhao" class="topinp"> </div>
          <div class="toptd">订单数量:<input v-model="form.dingdanshuliang" class="topinp"> </div>
          <div class="toptd">上架时间:<input v-model="form.shangjiashijian" type="date" class="topinp"> </div>
          <div class="toptd">老化数量:<input v-model="form.laohuashuliang" class="topinp"> </div>
          <div class="toptd">室{{ "\u3000" }}{{ "\u3000" }}温:<input v-model="form.shiwen" class="topinp"> </div>
          <div class="toptd topinp" />
        </div>
      </div>
      <div class="divborder">
        <!-------------------------------表格 ----------------------down ------------------->
        <div>
          <h3 style="text-align: left">一、产品配置:</h3>
          <div class="toptable">
            <div class="toptd"><input type="checkbox" :checked="form.huoniu">火{{ "\u3000" }}{{ "\u3000" }}牛:<input v-model="form.huoniu" class="topinp"> </div>
            <div class="toptd"><input type="checkbox" :checked="form.dianyuankaiguan">开关电源:<input v-model="form.dianyuankaiguan" class="topinp"> </div>
            <div class="toptd"><input type="checkbox" :checked="form.waizhidianyuan">外置电源:<input v-model="form.waizhidianyuan" class="topinp">V</div>
            <div class="toptd"><input v-model="form.shipeiqi" value="配" type="radio" name="shipeiqi">配<input v-model="form.shipeiqi" value="不配" type="radio" name="shipeiqi">不配 适配器</div>
          </div>
          <div class="toptable">
            <div class="toptd"><input type="checkbox" :checked="form.chongdiandianyong">充电电容:<input v-model="form.chongdiandianyong" class="topinp"> </div>
            <div class="toptd"><input type="checkbox" :checked="form.edingdianya">额定电压:<input v-model="form.edingdianya" class="topinp"> </div>
            <div class="toptd"><input type="checkbox" :checked="form.guochongdianya">过充电压:<input v-model="form.guochongdianya" class="topinp"></div>
            <div class="toptd"><input type="checkbox" :checked="form.guofangdianya">过放电压:<input v-model="form.guofangdianya" class="topinp"></div>
          </div>
          <div style="display: flex;text-align: left;margin-left: 20px">
            <div class="toptd"><input type="checkbox" :checked="form.gongnen">功{{ "\u3000" }}{{ "\u3000" }}能:<input v-model="form.gongnen" class="topinp"> </div>
            <div class="toptd" style="margin-left: 30px"><input type="checkbox" :checked="form.dianchiyongliangpihao">电池容量/批号:<input v-model="form.dianchiyongliangpihao" class="topinp"> </div>
          </div>
        </div>
        <div>
          <h3 style="text-align: left">二、老化项目:</h3>
          <div style="display: flex">
            <div style="margin-top: 10px;margin-left: 20px;">
              老化方式：
            </div>
            <div class="toptable3">
              <div class="toptd"><input type="checkbox" :checked="form.acgongnengs">AC功能:<input v-model="form.acgongnengs" class="topinp3">至<input v-model="form.acgongnenge" class="topinp3"></div>
              <div class="toptd"><input type="checkbox" :checked="form.kaiguanshiyans">开关试验:<input v-model="form.kaiguanshiyans" class="topinp3">至<input v-model="form.kaiguanshiyane" class="topinp3"></div>
              <div class="toptd"><input type="checkbox" :checked="form.laohuafangshiqita">其它<input v-model="form.laohuafangshiqita" class="topinp3">{{ "\u3000" }}<input v-model="form.laohuafangshiqitas" class="topinp3">至<input v-model="form.laohuafangshiqitae" class="topinp3"></div>
            </div>
          </div>
          <div style="display: flex">
            <div style="margin-top: 10px;margin-left: 20px;">
              老化时间：
            </div>
            <div class="toptable3">
              <div class="toptd"><input type="checkbox" :checked="form.zhaomings">照{{ "\u3000" }}明:<input v-model="form.zhaomings" class="topinp3">至<input v-model="form.zhaominge" class="topinp3"></div>
              <div class="toptd"><input type="checkbox" :checked="form.shedengs">射{{ "\u3000" }}灯:<input v-model="form.shedengs" class="topinp3">至<input v-model="form.shedenge" class="topinp3"></div>
              <div class="toptd"><input type="checkbox" :checked="form.gaofengs">高{{ "\u3000" }}风:<input v-model="form.gaofengs" class="topinp3">至<input v-model="form.gaofenge" class="topinp3"></div>
              <div class="toptd"><input type="checkbox" :checked="form.difengs">低{{ "\u3000" }}风:<input v-model="form.difengs" class="topinp3">至<input v-model="form.difenge" class="topinp3"></div>
              <div class="toptd"><input type="checkbox" :checked="form.laohuashijianqita">其它<input v-model="form.laohuashijianqita" class="topinp3">{{ "\u3000" }}<input v-model="form.laohuashijianqitas" class="topinp3">至<input v-model="form.laohuashijianqitae" class="topinp3"></div>
            </div>
          </div>
          <div style="display: flex">
            <div style="margin-top: 10px;margin-left: 20px;">
              充电时间：
            </div>
            <div class="toptable3">
              <div class="toptd"><input v-model="form.chongdianshijians" class="topinp3">至<input v-model="form.chongdianshijiane" class="topinp3"></div>
            </div>
          </div>
        </div>
        <div>
          <h3 style="text-align: left">三、巡查记录:</h3>
          <table class="tablehistory">
            <tr>
              <th class="first">
                <div style="text-align: right;">
                  检查项目
                </div>
                <div style="text-align: left;">
                  调整时间
                </div>
              </th>
              <th>
                老化电压（V）
              </th>
              <th>
                工作状态
              </th>
              <th>
                充电状态
              </th>
              <th>
                打开关状态
              </th>
              <th>
                收音状态
              </th>
              <th>
                其它
              </th>
            </tr>
            <tr>
              <td> <input v-model="form.xunjianshijian1" class="hisinput"> </td>
              <td> <input v-model="form.laohuadainya1" class="hisinput"> </td>
              <td> <input v-model="form.gongzuozhuantai1" class="hisinput"> </td>
              <td> <input v-model="form.chongdianzhuangtai1" class="hisinput"> </td>
              <td> <input v-model="form.dakaiguanzhuangtai1" class="hisinput"> </td>
              <td> <input v-model="form.shouyinzhuangtai1" class="hisinput"> </td>
              <td> <input v-model="form.qita1" class="hisinput"> </td>
            </tr>
            <tr>
              <td> <input v-model="form.xunjianshijian2" class="hisinput"> </td>
              <td> <input v-model="form.laohuadainya2" class="hisinput"> </td>
              <td> <input v-model="form.gongzuozhuantai2" class="hisinput"> </td>
              <td> <input v-model="form.chongdianzhuangtai2" class="hisinput"> </td>
              <td> <input v-model="form.dakaiguanzhuangtai2" class="hisinput"> </td>
              <td> <input v-model="form.shouyinzhuangtai2" class="hisinput"> </td>
              <td> <input v-model="form.qita2" class="hisinput"> </td>
            </tr>
            <tr>
              <td> <input v-model="form.xunjianshijian3" class="hisinput"> </td>
              <td> <input v-model="form.laohuadainya3" class="hisinput"> </td>
              <td> <input v-model="form.gongzuozhuantai3" class="hisinput"> </td>
              <td> <input v-model="form.chongdianzhuangtai3" class="hisinput"> </td>
              <td> <input v-model="form.dakaiguanzhuangtai3" class="hisinput"> </td>
              <td> <input v-model="form.shouyinzhuangtai3" class="hisinput"> </td>
              <td> <input v-model="form.qita3" class="hisinput"> </td>
            </tr>
          </table>
        </div>
        <!-------------------------------主信息 ----------------------up ------------------->
        <div>
          <h3 style="text-align: left">四、常规功能测试:</h3>
          <div style="margin-left: 10px">
            <div class="toptable3">
              <div class="toptd">充满指示灯功能:<input v-model="form.chongdianzhishiv" class="topinp3">V<input v-model="form.chongdianzhishima" class="topinp3">mA</div>
              <div class="toptd">USB输出:<input v-model="form.usbshuchuv" class="topinp3">V<input v-model="form.usbshuchuma" class="topinp3">mA</div>
              <div class="toptd">自动转应急功能<input v-model="form.zidongzhuanyingji" class="topinp3">A</div>
            </div>
            <div class="toptable3">
              <div class="toptd">调光功能:<input v-model="form.tiaoguang" value="合格" type="radio" name="tiaoguang">合格<input v-model="form.tiaoguang" value="不合格" type="radio" name="tiaoguang">不合格</div>
              <div class="toptd">充电灭灯功能:<input v-model="form.chongdianmiedeng" value="合格" type="radio" name="chongdianmiedeng">合格<input v-model="form.chongdianmiedeng" value="不合格" type="radio" name="chongdianmiedeng">不合格</div>
              <div class="toptd">内部工艺:<input v-model="form.neibugongyi" value="合格" type="radio" name="neibugongyi">合格<input v-model="form.neibugongyi" value="不合格" type="radio" name="neibugongyi">不合格</div>
            </div>
            <div style="width: 100%;display: flex">
              <div style="width: 50px">其它：</div><input v-model="form.changguiqita" class="btborder" style="width: 100%">
            </div>
          </div>
        </div>
        <!-------------------------------下拉选择 ----------------------up ------------------->
        <div>
          <h3 style="text-align: left">五、数据测试记录:</h3>
          <table class="tablehistory">
            <tr>
              <th class="first" rowspan="2">
                <div style="text-align: right;">
                  检验项目
                </div>
                <div style="text-align: left;">
                  序号
                </div>
              </th>
              <th colspan="3">
                充电电流（mA）
              </th>
              <th rowspan="2">
                漏电流（mA）
              </th>
              <th colspan="8">
                工作电流（mA）
              </th>
            </tr>
            <tr>
              <th>
                AC<input v-model="form.ac" style="width: 30px">V
              </th>
              <th>
                DC<input v-model="form.dc" style="width: 30px">V
              </th>
              <th>
                太阳能
              </th>
              <th>
                高档
              </th>
              <th>
                中档
              </th>
              <th>
                低档
              </th>
              <th>
                照明/强
              </th>
              <th>
                照明/弱
              </th>
              <th>
                射灯/强
              </th>
              <th>
                射灯/弱
              </th>
              <th />
            </tr>
            <tr>
              <td>标准值</td>
              <td> <input v-model="form.ac0" class="dinput"> </td>
              <td> <input v-model="form.dc0" class="dinput"> </td>
              <td> <input v-model="form.taiyangneng0" class="dinput"> </td>
              <td> <input v-model="form.loudianliu0" class="dinput"> </td>
              <td> <input v-model="form.gaodang0" class="dinput"> </td>
              <td> <input v-model="form.zhongdang0" class="dinput"> </td>
              <td> <input v-model="form.didang0" class="dinput"> </td>
              <td> <input v-model="form.zhaomingqiang0" class="dinput"> </td>
              <td> <input v-model="form.zhongmingruo0" class="dinput"> </td>
              <td> <input v-model="form.shedengqiang0" class="dinput"> </td>
              <td> <input v-model="form.shedengruo0" class="dinput"> </td>
              <td> <input v-model="form.kongbai0" class="dinput"> </td>
            </tr>
            <tr>
              <td>1#</td>
              <td> <input v-model="form.ac1" class="dinput"> </td>
              <td> <input v-model="form.dc1" class="dinput"> </td>
              <td> <input v-model="form.taiyangneng1" class="dinput"> </td>
              <td> <input v-model="form.loudianliu1" class="dinput"> </td>
              <td> <input v-model="form.gaodang1" class="dinput"> </td>
              <td> <input v-model="form.zhongdang1" class="dinput"> </td>
              <td> <input v-model="form.didang1" class="dinput"> </td>
              <td> <input v-model="form.zhaomingqiang1" class="dinput"> </td>
              <td> <input v-model="form.zhongmingruo1" class="dinput"> </td>
              <td> <input v-model="form.shedengqiang1" class="dinput"> </td>
              <td> <input v-model="form.shedengruo1" class="dinput"> </td>
              <td> <input v-model="form.kongbai1" class="dinput"> </td>
            </tr>
            <tr>
              <td>2#</td>
              <td> <input v-model="form.ac2" class="dinput"> </td>
              <td> <input v-model="form.dc2" class="dinput"> </td>
              <td> <input v-model="form.taiyangneng2" class="dinput"> </td>
              <td> <input v-model="form.loudianliu2" class="dinput"> </td>
              <td> <input v-model="form.gaodang2" class="dinput"> </td>
              <td> <input v-model="form.zhongdang2" class="dinput"> </td>
              <td> <input v-model="form.didang2" class="dinput"> </td>
              <td> <input v-model="form.zhaomingqiang2" class="dinput"> </td>
              <td> <input v-model="form.zhongmingruo2" class="dinput"> </td>
              <td> <input v-model="form.shedengqiang2" class="dinput"> </td>
              <td> <input v-model="form.shedengruo2" class="dinput"> </td>
              <td> <input v-model="form.kongbai2" class="dinput"> </td>
            </tr>
            <tr>
              <td>3#</td>
              <td> <input v-model="form.ac3" class="dinput"> </td>
              <td> <input v-model="form.dc3" class="dinput"> </td>
              <td> <input v-model="form.taiyangneng3" class="dinput"> </td>
              <td> <input v-model="form.loudianliu3" class="dinput"> </td>
              <td> <input v-model="form.gaodang3" class="dinput"> </td>
              <td> <input v-model="form.zhongdang3" class="dinput"> </td>
              <td> <input v-model="form.didang3" class="dinput"> </td>
              <td> <input v-model="form.zhaomingqiang3" class="dinput"> </td>
              <td> <input v-model="form.zhongmingruo3" class="dinput"> </td>
              <td> <input v-model="form.shedengqiang3" class="dinput"> </td>
              <td> <input v-model="form.shedengruo3" class="dinput"> </td>
              <td> <input v-model="form.kongbai3" class="dinput"> </td>
            </tr>
            <tr>
              <th class="first" rowspan="2">
                <div style="text-align: right;">
                  检验项目
                </div>
                <div style="text-align: left;">
                  序号
                </div>
              </th>
              <th colspan="3">
                转速（RPM）
              </th>
              <th rowspan="2">
                遥控距离（M）
              </th>
              <th colspan="6">
                工作时间（H）
              </th>
              <th colspan="2">
                其它
              </th>
            </tr>
            <tr>
              <th>
                高
              </th>
              <th>
                中
              </th>
              <th>
                低
              </th>
              <th>
                <input v-model="form.gongzuoh0" class="dinput">
              </th>
              <th>
                <input v-model="form.gongzuoh1" class="dinput">
              </th>
              <th>
                <input v-model="form.gongzuoh2" class="dinput">
              </th>
              <th>
                <input v-model="form.gongzuoh3" class="dinput">
              </th>
              <th>
                <input v-model="form.gongzuoh4" class="dinput">
              </th>
              <th>
                <input v-model="form.gongzuoh5" class="dinput">
              </th>
              <th>
                <input v-model="form.ceshiqita1" class="dinput">
              </th>
              <th>
                <input v-model="form.ceshiqita2" class="dinput">
              </th>
            </tr>
            <tr>
              <td>标准值</td>
              <td> <input v-model="form.rpmgao0" class="dinput"> </td>
              <td> <input v-model="form.rpmzhong0" class="dinput"> </td>
              <td> <input v-model="form.rpmdi0" class="dinput"> </td>
              <td> <input v-model="form.raokongjuli0" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh00" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh10" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh20" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh30" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh40" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh50" class="dinput"> </td>
              <td> <input v-model="form.ceshiqita10" class="dinput"> </td>
              <td> <input v-model="form.ceshiqita20" class="dinput"> </td>
            </tr>
            <tr>
              <td>1#</td>
              <td> <input v-model="form.rpmgao1" class="dinput"> </td>
              <td> <input v-model="form.rpmzhong1" class="dinput"> </td>
              <td> <input v-model="form.rpmdi1" class="dinput"> </td>
              <td> <input v-model="form.raokongjuli1" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh01" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh11" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh21" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh31" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh41" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh51" class="dinput"> </td>
              <td> <input v-model="form.ceshiqita11" class="dinput"> </td>
              <td> <input v-model="form.ceshiqita21" class="dinput"> </td>
            </tr>
            <tr>
              <td>2#</td>
              <td> <input v-model="form.rpmgao2" class="dinput"> </td>
              <td> <input v-model="form.rpmzhong2" class="dinput"> </td>
              <td> <input v-model="form.rpmdi2" class="dinput"> </td>
              <td> <input v-model="form.raokongjuli2" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh02" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh12" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh22" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh32" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh42" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh52" class="dinput"> </td>
              <td> <input v-model="form.ceshiqita12" class="dinput"> </td>
              <td> <input v-model="form.ceshiqita22" class="dinput"> </td>
            </tr>
            <tr>
              <td>3#</td>
              <td> <input v-model="form.rpmgao3" class="dinput"> </td>
              <td> <input v-model="form.rpmzhong3" class="dinput"> </td>
              <td> <input v-model="form.rpmdi3" class="dinput"> </td>
              <td> <input v-model="form.raokongjuli3" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh03" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh13" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh23" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh33" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh43" class="dinput"> </td>
              <td> <input v-model="form.gongzuoh53" class="dinput"> </td>
              <td> <input v-model="form.ceshiqita13" class="dinput"> </td>
              <td> <input v-model="form.ceshiqita23" class="dinput"> </td>
            </tr>
          </table>
        </div>
        <!-------------------------------大表格 ----------------------down ------------------->
        <div style="display: flex;justify-content: space-between;">
          <div style="text-align: left">
            <div class="btdiv">落地测试：<input v-model="form.luodiceshi" class="btborder" style="width: 200px"></div>
            <div class="btdiv">高压测试:<input v-model="form.gaoyaceshiv" class="input50">V<input v-model="form.gaoyaceshima" class="input50">mA</div>
            <div class="btdiv">结果：A：<input v-model="form.jieguoa" class="input50"> B:<input v-model="form.jieguob" class="input50"> C:<input v-model="form.jieguoc" class="input50"></div>
          </div>
          <div style="text-align: right">
            <div class="btdiv">AQL值：
              A：<select v-model="form.aqla" style="width: 60px">
                <option v-for="(item,index) in grades" :key="index" :value="item">{{ item }}</option>
              </select>
              B：<select v-model="form.aqlb" style="width: 60px">
                <option v-for="(item,index) in grades" :key="index" :value="item">{{ item }}</option>
              </select>
              C：<select v-model="form.aqlc" style="width: 60px">
                <option v-for="(item,index) in grades" :key="index" :value="item">{{ item }}</option>
              </select>
            </div>
            <div class="btdiv">AC/RE：
              A<input v-model="form.aca" class="input25">/<input v-model="form.rea" class="input25">
              B:<input v-model="form.acb" class="input25">/<input v-model="form.reb" class="input25">
              C:<input v-model="form.acc" class="input25">/<input v-model="form.rec" class="input25">
            </div>
           <!-- <div class="btdiv">判定：
              <input v-model="form.panding" value="合格" type="radio" name="panding">合格
              <input v-model="form.panding" value="特采" type="radio" name="panding">特采
              <input v-model="form.panding" value="返工" type="radio" name="panding">返工
            </div>-->
          </div>
        </div>
        <!-------------------------------div ----------------------down ------------------->
        <div class="condiv">
          <el-upload
            :action="fileUploadURL"
            list-type="picture-card"
            :on-success="handleUploadSuccess"
            :on-preview="handlePictureCardPreview"
            :on-exceed="handleExceed"
            :limit="6"
            :file-list="filList"
            :on-remove="handleRemove"
          >
            <i class="el-icon-plus" />
          </el-upload>
          <el-dialog :visible.sync="dialogVisible">
            <img width="100%" :src="dialogImageUrl" alt="">
          </el-dialog>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { save } from '@/api/rpage'
import { get as getRpAge } from '@/api/rpage'
import { get } from '@/api/qmilcode'
import { getNext } from '@/api/rpage'
import { getLast } from '@/api/rpage'
export default {
  name: 'Qm105e',
  data() {
    return {
      downtests: ['合格', '不合格', '不适用'],
      dialogVisible: false,
      dialogImageUrl: '',
      editVisible: false,
      filList: [],
      fileURL: process.env.VUE_APP_BASE_API,
      fileUploadURL: process.env.VUE_APP_BASE_API + '/file/upload',
      form: {},
      query: {
        sddate: new Date(),
        eddate: new Date(),
        pageIndex: 1,
        pageSize: 10,
        name: ''
      },
      page: [],
      grades: [0, 0.25, 0.4, 0.65, 1.0, 1.5, 2.5, 4.0, 6.5, 10, 15, 25],
      levels: ['S-1', 'S-2', 'S-3', 'S-4', 'I', 'II', 'III'],
      options: ['/', '√', '×'],
      datas: []
    }
  },
  created() {
    if (this.$route.query.id) {
      this.getInCome(this.$route.query.id)
    }
  },
  methods: {
    getInCome(id) {
      this.loading = true
      getRpAge(id).then(res => {
        this.loading = false
        this.form = res.data.data
        this.filList = []
        for (const image of this.form.images) {
          this.filList.push({ url: this.fileURL + image.imgUrl })
        }
      })
    },
    selTable(row) {
      this.form.cinvcode = row.cInvCode
      this.form.mdepcode = row.MDepCode
      this.form.mocode = row.MoCode
      this.form.moid = row.MoId
      this.form.modid = row.MoDId
      this.form.qty = row.Qty
      if (row.qcyqty) {
        this.form.qcyqty = row.Qty - row.qcyqty
      } else {
        this.form.qcyqty = row.Qty
      }
      this.form.ccomunitname = row.cComUnitName
      this.form.cdepname = row.cDepName
      this.form.cinvname = row.cInvName
      this.form.cinvstd = row.cInvStd
      this.form.ddate = row.dDate
      this.form.socode = row.socode
      this.form.isosid = row.iSOsID
      this.form.csoinvname = row.csoinvname
      this.form.csocode = row.cSOCode
      this.editVisible = true
    },
    copyBill() {
      this.form.id = null
      this.form.images = null
    },
    saveEdit() {
      save(this.form).then(res => {
        if (res.code === 200) {
          this.editVisible = false
          this.$message.success('保存成功!')
        } else {
          this.$message.error(res.medium)
        }
      })
    },
    toNext() {
      getNext(this.$route.query.id).then(res => {
        this.$router.push({ query: { id: res.data.data }})
        if (this.$route.query.id) {
          this.getInCome(this.$route.query.id)
        }
      })
    },
    toLast() {
      getLast(this.$route.query.id).then(res => {
        this.$router.push({ query: { id: res.data.data }})
        if (this.$route.query.id) {
          this.getInCome(this.$route.query.id)
        }
      })
    },
    changeAqla() {
      if (!this.form.level) {
        this.$message({
          showClose: true,
          message: '请检测质检等级',
          type: 'warning'
        })
        return
      }
      if (!this.form.qty) {
        this.$message({
          showClose: true,
          message: '请先填写质检数量',
          type: 'warning'
        })
        return
      }
      if (this.form.aqla === 0) {
        this.form.aca = 0
        this.form.rea = 1
      } else {
        const data = { level: this.form.level, qty: this.form.qty, grade: this.form.aqla }
        get(data).then(res => {
          this.form.aca = res.data.data.ac
          this.form.rea = res.data.data.re
          this.form = JSON.parse(JSON.stringify(this.form))
        })
      }
    },
    changeAqlb() {
      if (!this.form.level) {
        this.$message({
          showClose: true,
          message: '请检测质检等级',
          type: 'warning'
        })
        return
      }
      if (!this.form.qty) {
        this.$message({
          showClose: true,
          message: '请先填写质检数量',
          type: 'warning'
        })
        return
      }
      if (this.form.aqlb === 0) {
        this.form.acb = 0
        this.form.reb = 1
      } else {
        const data = { level: this.form.level, qty: this.form.qty, grade: this.form.aqlb }
        get(data).then(res => {
          this.form.acb = res.data.data.ac
          this.form.reb = res.data.data.re
          this.form = JSON.parse(JSON.stringify(this.form))
        })
      }
    },
    changeAqlc() {
      if (!this.form.level) {
        this.$message({
          showClose: true,
          message: '请检测质检等级',
          type: 'warning'
        })
        return
      }
      if (!this.form.qty) {
        this.$message({
          showClose: true,
          message: '请先填写质检数量',
          type: 'warning'
        })
        return
      }
      if (this.form.aqlc === 0) {
        this.form.acc = 0
        this.form.rec = 1
      } else {
        const data = { level: this.form.level, qty: this.form.qty, grade: this.form.aqlc }
        get(data).then(res => {
          this.form.acc = res.data.data.ac
          this.form.rec = res.data.data.re
          this.form = JSON.parse(JSON.stringify(this.form))
        })
      }
    },
    changeLevel() {
      if (this.form.aqla) {
        this.changeAqla()
      }
      if (this.form.aqlb) {
        this.changeAqlb()
      }
      if (this.form.aqlc) {
        this.changeAqlc()
      }
    },
    handleRemove(file, fileList) {
      const images = []
      for (const image of fileList) {
        if (image.response) {
          images.push({ imgUrl: image.response.data.data })
        } else {
          images.push({ imgUrl: image.url.replace(this.fileURL, '') })
        }
      }
      this.form.images = images
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url
      this.dialogVisible = true
    },
    handleExceed() {
      this.$message({
        showClose: true,
        message: '超出限定图片上传个数',
        type: 'error'
      })
    },
    handleUploadSuccess(res, file, fileList) {
      const images = []
      for (const image of fileList) {
        if (image.response) {
          images.push({ imgUrl: image.response.data.data })
        } else {
          images.push({ imgUrl: image.url.replace(this.fileURL, '') })
        }
      }
      this.form.images = images
    }
  }
}
</script>

<style scoped="sass">
  .cbody{
    background-color: #fcfcfc;
  }
  select{
    -webkit-appearance:none;
    -moz-appearance:none;
    appearance:none;
  }
  .content{
    margin: 5px auto;
    width: 900px;
    padding: 20px;
    font-size: 14px;
    font-weight: 400;
    background-color: #f7f7f7;
    text-align: center;
  }
  .condiv{
    text-align: left;
    border-width: thin;
    border-color: #c7c7c7;
    border-style: solid;
  }
  table{
    border-collapse: collapse;
    border-color: #c7c7c7;
  }
  td{
    border-style: solid;
    border-width: thin;
    border-color: #c7c7c7;
  }
  col2{
    colspan:2
  }
  th{
    border-style: solid;
    border-width: thin;
    font-weight: 400;
    border-color: #c7c7c7;
  }
  .toptable{
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    margin: 5px;
  }
  .toptable3{
    text-align: left;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    margin: 5px 2px;
  }
  .topinp3{
    border-width: 0 0 1px 0;
    background-color: #f7f7f7 ;
    width: 50px;
  }
  .toptd{
    margin: 3px;
  }
  .topinp{
    border-width: 0 0 1px 0;
    background-color: #f7f7f7 ;
    width: 100px;
  }
  .first:before{
    content: "";
    position: absolute;
    width: 1px;
    height:100px;/* 需要手调 ，线的长度 */
    background-color: black; /* 线的颜色 black */
    display: block;
    transform: rotate(-74deg);/* 需要手调 ，斜线的角度*/
    transform-origin: top;;
  }
  .first{
    width: 100px;
  }
  .tablehistory{
    width: 100%;
  }
  .hisinput{
    border-width: 0;
    width: 100%;
  }

  .dinput{
    width: 100%;
  }
  .input50{
    border-width: 0 0 1px 0;
    background-color: #f7f7f7 ;
    width: 100px;
  }
  .input25{
    border-width: 0 0 1px 0;
    background-color: #f7f7f7 ;
    width: 35px;
  }
  .btborder{
    border-width: 0 0 1px 0;
    background-color: #f7f7f7 ;
  }
  .btdiv{
    margin: 3px;
  }
  .divborder{
    padding: 5px;
    border-width: thin;
    border-color: #c7c7c7;
    border-style: solid;
  }
</style>
